<template>
    <div>
        <a-popconfirm title="确定删除该数据?" ok-text="确定" cancel-text="取消" @confirm="handClick">
            <a-button type="default"  :loading="loading">删除</a-button>
        </a-popconfirm>
    </div>
</template>
<script>
export default {
    name: 'PPTDelete',
    props: {
        onCallBack: {
            type: Function,
            default: () => { }
        },
        item: {
            type: Object,
            default: () => { }
        },
        onCallBack: {
            type: Function,
            default: () => { }
        },
        type: {
            type: String,
        }
    },
    data() {
        return {
            loading: false,
        }
    },
    methods: {
        handClick() {
            this.deleteQuest();
        },
        deleteQuest() {
            let params = {
                id: this.item.id
            };
            this.loading = true;
            let url;
            if(this.type == 'diy'){
                url = this.$deleteFormDataById;
            }else{
                url = this.$deleteFormData
            }
            this.getAxios(url, params)
                .then((res) => {
                    if (res.code === 200) {
                        this.$message.success(res.msg || '操作成功');
                        this.onCallBack();
                    } else {
                        this.$message.error(res.msg || "请稍后再试");
                    }
                })
                .catch((err) => { })
                .finally(() => {
                    this.loading = false;
                });
        },
    },
    mounted() {
    }
}
</script>
<style lang="less" scoped></style>